package com.jbyu.service.imp;

import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;

import jodd.io.FileUtil;

import com.jbyu.resource.DataResource;
import com.jbyu.service.ICodeWrite;

public class CodeWrite implements ICodeWrite {

	private DataResource dataresource;



	public void writeFile(InputStream in,String path) {
		FileOutputStream out = null;
		System.out.println("写入文件："+path);
		try {
			File file = new File(path.trim());
			file.createNewFile();
			out = new FileOutputStream(file);
			FileUtil.writeStream(file, in);
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				in.close();
				out.close();
			} catch (Exception e2) {
				e2.printStackTrace();
			}

		}
	}
	






	public DataResource getDataresource() {
		return dataresource;
	}

	public void setDataresource(DataResource dataresource) {
		this.dataresource = dataresource;
	}


}
